Repository navigation
feat(probe): resolve the workspace the agent-relay CLI selects (phase 2) - #2013
Conversation
The auto-format bot reformatted the OpenCode and Pi plugins, the Claude
mobile hook, the sign-in page and JSON fixtures that the core embeds with
include_str! and checks verbatim, failing two OpenCode tests. Restore them
from the phase 1 import and ignore crates/probe/{src,resources,tests/fixtures}
in Prettier (docs stay formatted).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The probe now finds its Relaycast workspace the way the CLI does, so local and self-hosted Relaycast work with no Cloud sign-in: - relay::workspace::cli mirrors the CLI ladder read-only: RELAY_WORKSPACE_KEY > AGENT_RELAY_WORKSPACE_KEY > RELAY_API_KEY, the AGENT_RELAY_PROJECT pin (with its persisted route and route credential), then the active entry of $AGENT_RELAY_HOME/workspaces.json. - relay::workspace::origin_binding reads relaycast-origins.json with the CLI's PBKDF2-SHA256 fingerprint (shared fixture with TS and the broker); a bound key goes only to its server, unbound to cast.agentrelay.com, RELAY_BASE_URL is the explicit destination, and malformed files fail closed. - The CLI source wins when it names a workspace; the Cloud sign-in is the fallback. A refused CLI selection leaves no workspace rather than falling back, and neither source's key goes to the other's origin. - Workspace.source records the source; Cloud recovery only runs for Cloud keys, and a key rotated in workspaces.json is picked up on refresh. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Workspace source and origin bindings crates/probe/src/relay/workspace.rs, crates/probe/src/relay/workspace/origin_binding.rs |
Workspace now records its source. Origin-binding files map credential fingerprints to validated server origins. |
CLI selection and transport validation crates/probe/src/relay/workspace/cli.rs, crates/probe/src/relay/workspace/cli/tests.rs |
The resolver selects credentials from CLI environment variables, an eligible project pin, or the active store entry. It validates persisted routes and credential-origin matches. Tests cover selection, transport, file errors, and path handling. |
Daemon discovery and workspace identity crates/probe/src/relay/daemon.rs, crates/probe/src/relay/messaging.rs, crates/probe/src/relay/workspace.rs, crates/probe/src/relay/{desktop_identity,spawn,state}.rs, crates/probe/src/relay/spawn/control/tests.rs |
The daemon resolves CLI workspaces, reports changed discovery problems, and includes workspace source in activity messages. Messaging credential selection requires matching workspace origin and account key. |
Cloud recovery and release documentation crates/probe/src/relay/account/workspace_recovery.rs, crates/probe/src/relay/workspace_recovery_tests.rs, docs/probe-move.md, CHANGELOG.md, crates/probe/docs/agent-relay-probe.md |
Key recovery applies only to Cloud-sourced workspaces. Tests cover CLI key refresh and refusal without Cloud fallback. The migration document and changelog describe workspace selection. |
Priority:
Estimated code review effort: 4 (Complex) | ~45 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant Daemon as daemon::rediscover_workspace
participant Resolver as workspace::resolve
participant CLI as cli::resolve
participant Bindings as origin_binding::read_bindings
Daemon->>Resolver: resolve with configured home
Resolver->>CLI: check CLI workspace selection
CLI->>Bindings: read credential origin bindings
Bindings-->>CLI: return validated bindings
CLI-->>Resolver: return workspace, no selection, or error
Resolver-->>Daemon: return selected workspace or Cloud fallback
Possibly related PRs
- AgentWorkforce/relay#843: Adds CLI workspace setup and token commands that provide state consumed by this probe change.
- AgentWorkforce/relay#2011: Changes project workspace-pin contents and route metadata that this resolver reads.
- AgentWorkforce/relay#1992: Adds project-session, workspace-store, and origin-binding formats that this resolver reads.
Merge Risk: 
Minimal · up to f64c0
-
No issue identified in the reviewed workspace-selection changes requires resolution before merging.
Pre-merge checks: 
3 · 
2
-
Failed checks: 2 warnings Passed checks: 3 passedFull details: Description check
-
Explanation
The description provides a detailed summary and verification results, but it omits the required RelayFlow Proof section and does not provide the required change type or exactly one RelayFlow case. The test plan is also not presented using the template checkboxes.
Resolution
Add the required RelayFlow Proof section. Set Change type to
featureorbugfix, and specify exactly one case undertests/relayflows/cases/<case-id>/. Add the template Test Plan checkboxes and mark the applicable items.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 60.53% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 38 functions across 12 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
I’m a rabbit with a key in my paw,
I hop through the workspace files I saw.
Pins and origins line up just right,
Cloud waits when no CLI takes flight.
I thump for safe routes, then burrow away.
Comment @coderabbitai help to get the list of available commands.
…t/probe-cli-workspace # Conflicts: # .prettierignore
…t/probe-cli-workspace
…t/probe-cli-workspace
…t/probe-cli-workspace
…t/probe-cli-workspace
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea940dc8a5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
[High impact] The PR appears safe to merge; the remaining Windows test gap is non-blocking.
|
…the CLI store reader
- Roster and recipient lookups for sends made as you now require the
daemon's workspace to be the signed-in account's own workspace (same
key on the identity's origin), not just the same base URL, so a CLI
workspace on cast.agentrelay.com is never taken as proof about sends
in the account's workspace.
- workspaces.json: a top-level null, or a non-string `active` or entry
`key`, is an error as in the CLI; a null `workspaces` stays empty, as
the CLI's `parsed.workspaces ?? {}` reads it.
- Windows: strip the \\?\ and \\?\UNC\ verbatim prefixes before hashing
credential refs, as Node's realpathSync.native prints paths; add a
Windows test pinned to the CLI's algorithm.
- CHANGELOG: note the probe's CLI-first workspace selection.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…waiting - settings.set asks each settings extension to refuse a change before anything is written (SettingsExtension::refuse), so a batch refused for history_retention_days (history_unavailable without history, an invalid value with it) saves none of its other settings. - Without history, send_cloud never refuses: a cloud-shaped id can name a stopped local Devin session, so the local Waiting stands. - Run the retained-Codex-row admission test in both builds; only the cloud-catalog helper and test stay history-only. - README: Cloud sign-in is the current workspace path, CLI resolution comes in #2013; test commands keep RUSTUP_HOME/CARGO_HOME before hiding HOME. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps both the no-history build notes and #2013's CLI workspace resolution; the README now describes CLI resolution as current. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase 2 of moving the probe core into relay (stacked on #2012). The probe now finds its Relaycast workspace the way the
agent-relayCLI does, sorelay init's local server and self-hosted servers work with no Cloud sign-in.What changed
relay::workspace::cli: a read-only CLI source. It never writes the CLI's files. It follows the CLI's ladder (resolveWorkspaceSelection+resolveWorkspaceTransport):RELAY_WORKSPACE_KEY>AGENT_RELAY_WORKSPACE_KEY>RELAY_API_KEY<project>/.agentworkforce/relay/workspace-key.jsonwhenAGENT_RELAY_PROJECTnames the project. A malformed pin falls through. Persisted routes and their route credential (relaycastApiKeyRef→relaycast-credentials.json) get the CLI's checks.$AGENT_RELAY_HOME/workspaces.json. If the file exists but can't be read, resolution fails.relay::workspace::origin_binding: readsrelaycast-origins.jsonusing the CLI's PBKDF2-HMAC-SHA256 fingerprint (via theringalready linked; no new dependency). It is tested againstpackages/contracts/fixtures/relaycast-origin-binding.json, so TS, the broker and the probe all agree. The origin is chosen in this order: persisted route (Agent Relay gateways only; a key bound to another server is refused) →RELAY_BASE_URL→ the binding →https://cast.agentrelay.com.http://127.0.0.1:8787-style origins and self-hosted ports and path prefixes are accepted. If the bindings file orRELAY_BASE_URLis malformed, resolution fails closed.RELAYCAST_URLre-origins only the account's key).Workspace.sourcerecords which source the key came from.workspaces.jsonis picked up by the next 30 s rediscovery and verified. Cloud recovery runs only forCloud-sourced keys.Core.workspaceas the workspace, so per-project workspaces that differ from the machine's active one are a follow-up.crates/probe/{src,resources,tests/fixtures}to.prettierignore.docs/probe-move.md(phase 2 done) andcrates/probe/docs/relay-core.md(Workspace discovery).Behaviour change to note
A desktop that is signed in to Cloud and has an active CLI workspace now uses the CLI's workspace for messaging. Uploads still go to the account. This reaches desktop users only in phase 4.
Verification
HOME=<empty> cargo test --locked --no-fail-fastincrates/probe: everything passes except the two known ones:cloud::tests::cloud_bearer_reuses_only_a_matching_unexpired_official_cli_session(env-dependent) andlive::selected_remote::tests::selected_claude_worker_refreshes_shallow_catalog_and_selected_evidence(flake). 41 new or updated workspace tests cover precedence, origin binding with the shared fixture, malformed files, localhost, persisted routes, the combination rule, rotation, and recovery gating.HOME,AGENT_RELAY_HOME, app-data dir and socket,env -i; no Cloud sign-in):npx -y agent-relay@next init --yes --tools none --port 8799, thenagent-relay-probe relay serve --headless.relay call status.getshowsbase_url http://127.0.0.1:8799,verification: verified,workspace_name: local. With a corruptedrelaycast-origins.jsonthe probe reportsstate: missingand does not fall back.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Agent Relay sessions
claudesessionad9499a6· opened viagh pr create· last active 2026-10-28claudesessiona7931a00· contributor · rangh prcommands · last active 2026-10-29claudesession8ab900cc· contributor · pushed commits · last active 2026-10-29